package com.lyl.momanapp.util.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;


/**
 * 名字 梁亚龙
 * 时间 2017/8/9.
 * QQ邮箱 503934353@qq.com
 */

public class YuanJiaoImageView extends android.support.v7.widget.AppCompatImageView {

    //圆角弧度
    private float[] rids = {10.0f,10.0f,10.0f,10.0f,10.0f,30.0f,10.0f,10.0f,};
    public YuanJiaoImageView(Context context) {
        super(context);
    }
    public YuanJiaoImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    public YuanJiaoImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
    protected void onDraw(Canvas canvas) {
        Path path = new Path();
        int w = this.getWidth();
        int h = this.getHeight();
        //绘制圆角imageview
        path.addRoundRect(new RectF(0,0,w,h),rids, Path.Direction.CW);
        canvas.clipPath(path);
        super.onDraw(canvas);
    }
}
